#pragma once

#include "sys/IInterface.h"
#include "WorkspaceID.h"
#include <vgraph>

interface IDocument;interface Graphics;class SystemEventArgs;interface IEventHandlers;interface ISelection;

delegate Delegate<void(const Rect& /*boundbox*/,bool /*whole*/)> CanvasRefreshingEventHandler;
delegate Delegate<void(const Size& /*size*/)> ScrollEventHandler;

class StateContext;
/*input : pixel format*/
interface IView : public IInterface
{
	DEFINE_IID(IID_View)

	virtual void Create(uintptr context,const Size& size) = 0;
	virtual void Draw(uintptr context,const Size& size) = 0;
	virtual void Close() = 0;
	virtual bool Event(SystemEventArgs* e) = 0;
	virtual bool IsActive() = 0;
	virtual void SetActive(bool active=true) = 0;

	virtual void Refresh() = 0;
	virtual void Refresh(const Rect& boundbox) = 0;
	virtual void Scroll() = 0;

	virtual real GetScale() const  =0;
	virtual void Scale(real scale,bool increase=true) = 0;
	virtual void SetViewPoint(const Point& viewpoint) = 0;
	virtual const Point& GetViewPoint() const = 0;

	virtual void LinkDocument(IDocument* document) = 0;
	virtual IDocument* GetDocument() const  =0;
	virtual Graphics* GetGraphics() const = 0;
	virtual IEventHandlers* GetEventHandlers() const = 0;

	//for inner usage
	event_declare(CanvasRefreshingEventHandler,CanvasRefreshing);
	event_declare(ScrollEventHandler,Scrolling);
};